// UnitInfo.java
package com.wormhole.wormholemanagement.entity;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.*;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import java.time.LocalDateTime;

/**
 * 单位信息实体类
 * 对应数据库中的unit_info表，存储单位相关信息
 */
@Getter
@Setter
@Entity
@Table(name = "unit_info")
@Data
@Schema(description = "单位信息实体类")
public class UnitInfo {

    /**
     * 主键ID，自动生成
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Schema(description = "主键ID", example = "1")
    private Long ID;

    /**
     * 单位名称，不能为空，最大长度128字符
     */
    @Column(nullable = false, length = 128)
    @Schema(description = "单位名称", example = "某某公司", requiredMode = Schema.RequiredMode.REQUIRED)
    private String unit_name;

    /**
     * 全宗号，最大长度64字符
     */
    @Column(length = 64)
    @Schema(description = "全宗号", example = "QZH001")
    private String recordGroupNum;

    /**
     * 档案门类，最大长度64字符
     */
    @Column(length = 64)
    @Schema(description = "档案门类", example = "文书档案")
    private String fileType;

    /**
     * 保存期限，最大长度64字符
     */
    @Column(length = 64)
    @Schema(description = "保存期限", example = "永久")
    private String retentionPeriod;

    /**
     * 机构问题，最大长度64字符
     */
    @Column(length = 64)
    @Schema(description = "机构问题", example = "行政管理")
    private String orgIssue;

    /**
     * 案件类别，最大长度64字符
     */
    @Column(length = 64)
    @Schema(description = "案件类别", example = "合同纠纷")
    private String caseFileCate;

    /**
     * 创建时间，由Hibernate自动设置
     */
    @CreationTimestamp
    @Schema(description = "创建时间", example = "2023-01-01T12:00:00")
    private LocalDateTime createdDt;

    /**
     * 更新时间，由Hibernate自动更新
     */
    @UpdateTimestamp
    @Schema(description = "更新时间", example = "2023-01-01T12:00:00")
    private LocalDateTime updatedDt;

    /**
     * 创建用户，最大长度64字符
     */
    @Column(length = 64)
    @Schema(description = "创建用户", example = "张三")
    private String createUser;

    /**
     * 更新用户，最大长度64字符
     */
    @Column(length = 64)
    @Schema(description = "更新用户", example = "李四")
    private String updateUser;
}
